import QtQuick 2.6
import QtQuick.Controls 1.5

ApplicationWindow {
    visible: true
    width: 640
    height: 480
    title: qsTr("Navigation")

    DLButton
    {
        width: 100
        height: 100
        x:parent.width-width
        y:0
        onClicked:
        {
            if(navigation.state === "state1")
            {
                navigation.state = "state2"
                console.log("切换至状态2")
            }
            else
            {
                navigation.state = "state1"
                console.log("切换至状态1")
            }
            console.log(navigation.width+"   "+navigation.height)

        }
    }


    DLNavigation
    {
        id:navigation
        navigation:navigationmodel
        state: "state1"
        ListModel
        {
            id:navigationmodel
            ListElement{btnname:"xxx";btnnomer:"qrc:/Images/001.png";btnhover:"qrc:/Images/002.png";btnpress:"qrc:/Images/003.png"}
            ListElement{btnname:"ccc";btnnomer:"qrc:/Images/001.png";btnhover:"qrc:/Images/002.png";btnpress:"qrc:/Images/003.png"}
            ListElement{btnname:"vvv";btnnomer:"qrc:/Images/001.png";btnhover:"qrc:/Images/002.png";btnpress:"qrc:/Images/003.png"}
            ListElement{btnname:"ddd";btnnomer:"qrc:/Images/001.png";btnhover:"qrc:/Images/002.png";btnpress:"qrc:/Images/003.png"}
            ListElement{btnname:"bbb";btnnomer:"qrc:/Images/001.png";btnhover:"qrc:/Images/002.png";btnpress:"qrc:/Images/003.png"}
            ListElement{btnname:"nnn";btnnomer:"qrc:/Images/001.png";btnhover:"qrc:/Images/002.png";btnpress:"qrc:/Images/003.png"}
            ListElement{btnname:"mmm";btnnomer:"qrc:/Images/001.png";btnhover:"qrc:/Images/002.png";btnpress:"qrc:/Images/003.png"}
        }
        states:
            [
            State {
                name: "state1"
                PropertyChanges {
                    target: navigation
                    y:parent.height
                }
            },
            State {
                name: "state2"
                PropertyChanges {
                    target: navigation
                    y:parent.height-navigation.height
                }
            }
        ]

        transitions:
            [
            Transition {
                from: "*"
                to: "*"
                PropertyAnimation {
                    properties: "y"; duration: 1000 }
            }
        ]


    }

}
